package com.samuel.controller;

import com.samuel.entities.CommonResult;
import com.samuel.entities.Order;
import com.samuel.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 订单实体类
 * @author a neng huang
 * @since 2021-02-25 10:16
 */
@RestController
@RequestMapping("order/api")
public class OrderController {

    @Resource
    private OrderService orderService;

    @GetMapping("list")
    public CommonResult<List<Order>> list() {
        return new CommonResult<>(200, "获取成功", orderService.list());
    }

    @GetMapping("save")
    public CommonResult<Integer> save(Order order) {
        return new CommonResult<>(200, "保存成功", orderService.create(order));
    }
}
